package cn.itcast.tags.tools

import org.apache.spark.sql.{DataFrame, SparkSession}

object HBaseToolsTest {
  def main(args: Array[String]): Unit = {
    val spark: SparkSession = SparkSession.builder()
      .appName(this.getClass.getSimpleName.stripSuffix("$"))
      .master("local[4]")
      .config("spark.serializer", "org.apache.spark.serializer.KryoSerializer")
      .getOrCreate()

    import spark.implicits._
    val df: DataFrame = HBaseTools.read(spark, "bigdata-cdh01.itcast.cn", "2181", "tbl_profile", "user", Seq("userId", "tagIds"))

    //println(s"count = ${df.count()}")
    df.printSchema()
    df.show(100, truncate = false)


    df.count()
/*    HBaseTools.write(
      df, "bigdata-cdh01.itcast.cn", "2181",
      "tbl_users123", "info", "id"
    )*/

    spark.stop()
  }

}
